package com.hontech.bvapp2.ui.parts.drop

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.Button
import android.widget.FrameLayout
import com.hontech.bvapp2.R
import com.hontech.bvapp2.device.cp.Drop
import com.hontech.bvapp2.ui.dialog.runProg
import com.hontech.bvapp2.utils.onClick

class DropCupParts (context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) {

    init {
        val view = LayoutInflater.from(context).inflate(R.layout.parts_drop_drop_cup, this)
        val btn1 = view.findViewById<Button>(R.id.id_drop_btn_cup1)
        val btn2 = view.findViewById<Button>(R.id.id_drop_btn_cup2)
        val btn3 = view.findViewById<Button>(R.id.id_drop_btn_cup3)

        btn1.onClick {
            runProg("落杯", "落杯1") {
                Drop.dropCup(1)
            }
        }

        btn2.onClick {
            runProg("落杯", "落杯2") {
                Drop.dropCup(2)
            }
        }

        btn3.onClick {
            runProg("落杯", "落杯3") {
                Drop.dropCup(3)
            }
        }
    }
}